{extend name="platform/base" /}
{block name="resources"}
<script type="text/javascript" src="__STATIC__/My97DatePicker/WdatePicker.js"></script>

<style>
.col-sm-2-p{
	padding-right: 2px;
 	padding-left: 2px;
}
</style>
{/block}

 {block name="main"}
<div class="row padder-v">
 	<div class="col-sm-1"></div>
	<div class="col-sm-2">
		<input type="text" id="search_text" class="input-sm form-control" placeholder="请输入订单号">
	</div>
	<div class="col-sm-2">
		<select class="input-sm form-control" id="shop_id">
			<option value="-1">请选择店铺</option>
			{foreach name="shop_list" item="v"}
				<option value="{$v.shop_id}">{$v.shop_name}</option>
			{/foreach}
		</select>
	</div>
	<div class="col-sm-2">
		<input type="text" id='startDate' placeholder="请选择开始日期" class="input-sm form-control" onclick="WdatePicker()"/>
	</div>
	<div class="col-sm-2">
		<input type="text" id='endDate' placeholder="请选择结束日期" class="input-sm form-control"  onclick="WdatePicker()" />
	</div>
	
	<div class="col-sm-2 ">
		<select class="input-sm form-control"  id="order_status">
			<option value="">请选择订单状态</option>
			<option value="">全部</option>
			<option value="0" {eq name="$Request.get.orderstatus" value="0"}selected{/eq}>待付款</option>
			<option value="1" {eq name="$Request.get.orderstatus" value="1"}selected{/eq}>待发货</option>
			<option value="2" {eq name="$Request.get.orderstatus" value="2"}selected{/eq}>待收货</option>
			<option value="3" {eq name="$Request.get.orderstatus" value="3"}selected{/eq}>已收货</option>
			<option value="4" {eq name="$Request.get.orderstatus" value="4"}selected{/eq}>交易成功</option>
			<option value="5" {eq name="$Request.get.orderstatus" value="5"}selected{/eq}>已关闭</option>
			<option value="-1" {eq name="$Request.get.orderstatus" value="-1"}selected{/eq}>退款中</option>
		</select>
	</div>
	<div class="col-sm-1">
		<button class="btn btn-sm btn-default" type="button"
			onclick="LoadingInfo(1)">搜索</button>
	</div>
</div>
<section class="panel panel-default">
	<table class="table table-striped b-light text-sm">
		<colgroup>
				<col width="3%">
				<col width="15%">
				<col width="15%">
				<col width="15%">
				<col width="15%">
				<col width="10%">
				<col width="12%">
				<col width="8%">
				<col width="8%">
		</colgroup>
		<thead>
			<tr class="left">
				<th><input type="checkbox"></th>
				<th>订单编号</th>
				<th>店铺</th>
				<th>买家</th>
				<th class="center">下单时间</th>
				<th class="right">订单总额</th>
				<th class="center">订单类型</th>
				<th class="center">订单状态</th>
				<th class="center">操作</th>
			</tr>
		</thead>
		<tbody id="list">
			<tr></tr>
		</tbody>
	</table>
	{include file="platform/page" /}
</section>
{/block} {block name="script"}
<script type="text/javascript">
$(function(){
	LoadingInfo(1);
});
	function LoadingInfo(pageIndex) {
		var search_text = $("#search_text").val();
		var start_date = $("#startDate").val();
		var end_date = $("#endDate").val();
		var shop_id = $("#shop_id").val();
// 		var user_name = $("#userName").val();
// 		var order_no = $("#orderNo").val();
		var order_status = $("#order_status").val();	
		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/order/orderlist')}",
			async : true,
			data : {
				"pageIndex" : pageIndex,
				"order_no" : search_text,
				"order_status":order_status,
				"shop_id":shop_id,
				"start_date":start_date,
				"end_date":end_date
			},
			success : function(data) {
				var html = '';
				$("#total_count_num").text(data["total_count"]);
				$("#page_count_num").text(data["page_count"]);
				$("#page_count").val(data["page_count"]);
				$("#pageNumber a").remove();
				if (data["data"].length > 0) {
					for (var i = 0; i < data["data"].length; i++) {
						html += '<tr class="left">';
						html += '<td><input type="checkbox" name="sub" value="'+ data['data'][i]['ordre_id']+'"></td>';
						html += '<td>'+data['data'][i]['order_no']+'</td>';
						html += '<td>' + data["data"][i]["shop_name"] + '</td>';
						html += '<td>' + data["data"][i]["user_name"] + '</td>';
						html += '<td class="center">' + timeStampTurnTime(data["data"][i]["create_time"]) + '</td>';
						/*如果为积分兑换订单 */
						if(data["data"][i]["order_type"]==8){
							html += '<td class="right">' + data["data"][i]["point"] + ' 积分</td>';
							html += '<td class="center">积分订单</td>';	
						}
						else
						{
							html += '<td class="right">￥ ' + data["data"][i]["order_money"] + '</td>';
							if(data["data"][i]["order_type"]==2){
								html += '<td class="center">虚拟订单</td>';
							}else if(data["data"][i]["order_type"]==3){
								html += '<td class="center">团购订单</td>';
							}else if(data["data"][i]["order_type"]==4){
								html += '<td class="center">拼团订单</td>';
							}else if(data["data"][i]["order_type"]==5){
								html += '<td class="center">限时订单</td>';
							}else{
								html += '<td class="center">{:lang('regular_orders')}</td>';
							}
							
						}
						

						
						html += '<td class="center">' + data["data"][i]["status_name"] + '</td>';
						
						
						html += '<td class="center"><a href="'+ __URL('PLATFORM_MAIN/order/orderdetail?order_id=' + data["data"][i]["order_id"]) + '">查看</a></td>';
						html += '</tr>';
					}
				} else {
					html += '<tr align="center"><td colspan="8">暂无订单的数据记录</td></tr>';
				}
				$("#list").html(html);
				var totalpage = $("#page_count").val();
				if (totalpage == 1) {
					changeClass("all");
				}
				var $html = pagenumShow(jumpNumber,totalpage,{$pageshow})
				$("#pageNumber").append($html);
			}
		});
	}
	$("#search_text").keypress(function(e){
		if(e.keyCode == 13){
			LoadingInfo(1);
		}
	});
</script>
{/block}
